home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / tde31.zip / TDESTR.H < prev    next >
C/C++ Source or Header  |  1993-08-29  |  27KB  |  742 lines

  1. /*
  2.  * New editor name:  tde, the Thomson-Davis Editor.
  3.  * Author:           Frank Davis
  4.  * Date:             June 5, 1991
  5.  *
  6.  * This modification of Douglas Thomson's code is released into the
  7.  * public domain, Frank Davis.  You may distribute it freely.
  8.  *
  9.  * This file contains define's and structure declarations common to all
  10.  * editor modules.  It should be included in every source code module.
  11.  *
  12.  * I'm so stupid, I can't keep up with which declarations are in which
  13.  * file.  I decided to put all typedefs, structs, and defines in one file.
  14.  * If I don't, I end up defining a typedef one way in one file and a
  15.  * completely different way in another file.
  16.  */
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include <stdlib.h>
  22. #include <ctype.h>
  23. #include <conio.h>
  24. #include <assert.h>
  25. #if defined( __MSC__ )
  26.    #include <malloc.h>          /* for memory allocation */
  27.    #if defined( toupper )
  28.        #undef toupper
  29.    #endif
  30. #else
  31.    #include <alloc.h>           /* for memory allocation */
  32. #endif
  33.  
  34.  
  35. /*
  36.  * defines for the inline assembler.
  37.  */
  38. #if defined( __MSC__ )
  39.    #define  ASSEMBLE   _asm
  40. #else
  41.    #define  ASSEMBLE   asm
  42. #endif
  43.  
  44.  
  45. #define MAX_COLS            80  /* widest screen ever used */
  46. #define MAX_LINES           24  /* highest screen ever used */
  47. #define BUFF_SIZE         1042  /* buffer size for lines */
  48. #define MAX_LINE_LENGTH   1040  /* longest line allowed in file */
  49. #define FNAME_LENGTH        45  /* maximum file name length in lite bar */
  50. #define NO_MARKERS           3  /* maximum no. of markers */
  51. #define UNDO_STACK_LEN     200  /* number of lines in undo stack */
  52.  
  53. /*
  54.  * when we read in a file, lets try to match the size of the read buffer
  55.  *   with some multiple of a hardware or software cache that may be present.
  56.  */
  57. #define READ_LENGTH             1024
  58. #define DEFAULT_BIN_LENGTH      64
  59.  
  60.  
  61. #define REGX_SIZE               200     /* maximum number of nodes in nfa */
  62.  
  63.  
  64. /*
  65.  * general defines.
  66.  */
  67. #define ERROR             (-1)  /* abnormal termination */
  68. #define OK                   0  /* normal termination */
  69. #define TRUE                 1  /* logical true */
  70. #define FALSE                0  /* logical false */
  71.  
  72. #define MAX_KEYS           256  /* number of special keys recognized by TDE */
  73. #define MAX_TWO_KEYS       128  /* number of two key-combos allowed by TDE  */
  74. #define STROKE_LIMIT      1024  /* number of key strokes in playback buffer */
  75.  
  76.  
  77. #define STACK_UNDERFLOW      1  /* code for underflowing macro stack */
  78. #define STACK_OVERFLOW       2  /* code for overflowing macro stack */
  79. #define SAS_P               20  /* number of sas pointers to tokens */
  80. #define NUM_FUNCS          139
  81.  
  82. #define NUM_COLORS          14  /* number of color fields in TDE */
  83.  
  84. /*
  85.  * special cases for keyboard mapping -  see bottom of main.c
  86.  */
  87. #define RTURN           262           /* Return key = 262 */
  88. #define ESC             258           /* Escape key = 258 */
  89. #define CONTROL_BREAK   269           /* Control-Break = 269 */
  90.  
  91.  
  92. /*
  93.  * The following defines are used by the "error" function to indicate
  94.  *  how serious the error is.
  95.  */
  96. #define WARNING         1    /* user must acknowledge, editor continues */
  97. #define FATAL           2    /* editor aborts - very rare! */
  98. #define INFO            3    /* display message, acknowledge, continue */
  99.  
  100.  
  101. /*
  102.  * define the type of block marked by user and block actions
  103.  */
  104. #define NOTMARKED       0    /* block type undefined */
  105. #define BOX             1    /* block marked by row and column */
  106. #define LINE            2    /* block marked by begin and end lines */
  107. #define STREAM          3    /* block marked by begin and end characters */
  108.  
  109. #define MOVE            1
  110. #define DELETE          2
  111. #define COPY            3
  112. #define KOPY            4
  113. #define FILL            5
  114. #define OVERLAY         6
  115. #define NUMBER          7
  116. #define SWAP            8
  117.  
  118. #define LEFT            1
  119. #define RIGHT           2
  120.  
  121. #define ASCENDING       1
  122. #define DESCENDING      2
  123.  
  124.  
  125. /*
  126.  * three types of ways to update windows
  127.  */
  128. #define LOCAL           1
  129. #define NOT_LOCAL       2
  130. #define GLOBAL          3
  131.  
  132. #define CURLINE         1
  133. #define NOTCURLINE      2
  134.  
  135.  
  136. /*
  137.  * search/replace flags.
  138.  */
  139. #define BOYER_MOORE     0
  140. #define REG_EXPRESSION  1
  141.  
  142. #define CLR_SEARCH      0
  143. #define WRAPPED         1
  144. #define SEARCHING       2
  145. #define REPLACING       3
  146. #define NFA_GAVE_UP     4
  147.  
  148. #define IGNORE          1
  149. #define MATCH           2
  150.  
  151. #define PROMPT          1
  152. #define NOPROMPT        2
  153.  
  154. #define FORWARD         1
  155. #define BACKWARD        2
  156.  
  157. #define BEGIN           1
  158. #define END             2
  159.  
  160.  
  161. #define BEGINNING       1
  162. #define CURRENT         2
  163.  
  164. /*
  165.  * word wrap flag.
  166.  */
  167. #define NO_WRAP         0
  168. #define FIXED_WRAP      1
  169. #define DYNAMIC_WRAP    2
  170.  
  171. /*
  172.  * date and time formats
  173.  */
  174. #define MM_DD_YY        0
  175. #define DD_MM_YY        1
  176. #define YY_MM_DD        2
  177. #define MM_DD_YYYY      3
  178. #define DD_MM_YYYY      4
  179. #define YYYY_MM_DD      5
  180.  
  181. #define _12_HOUR        0
  182. #define _24_HOUR        1
  183.  
  184.  
  185. /*
  186.  * used in interrupt 0x21 function xx for checking file status
  187.  */
  188. #define EXIST           0
  189. #define WRITE           2
  190. #define READ            4
  191. #define READ_WRITE      6
  192.  
  193. #define NORMAL          0x00
  194. #define READ_ONLY       0x01
  195. #define HIDDEN          0x02
  196. #define SYSTEM          0x04
  197. #define VOLUME_LABEL    0x08
  198. #define SUBDIRECTORY    0x10
  199. #define ARCHIVE         0x20
  200.  
  201. /*
  202.  * critical error def's
  203.  */
  204. #define RETRY           1
  205. #define ABORT           2
  206. #define FAIL            3
  207.  
  208.  
  209. /*
  210.  * flags used for opening files to write either in binary or text mode.
  211.  * crlf is for writing files in text mode - Operating System converts
  212.  * lf to crlf automatically on output.  in binary mode, lf is not translated.
  213.  */
  214. #define NATIVE          1
  215. #define CRLF            2
  216. #define LF              3
  217. #define BINARY          4
  218. #define TEXT            5
  219.  
  220. #define OVERWRITE       1
  221. #define APPEND          2
  222.  
  223. /*
  224.  * characters used in tdeasm.c to display eol and column pointer in ruler
  225.  */
  226. #define EOL_CHAR        0x11
  227. #define RULER_PTR       0x19
  228. #define RULER_FILL      0x2e
  229. #define RULER_TICK      0x04
  230. #define LM_CHAR         0xb4
  231. #define RM_CHAR_RAG     0x3c
  232. #define RM_CHAR_JUS     0xc3
  233. #define PGR_CHAR        0x14
  234.  
  235.  
  236. /*
  237.  * character used two separate vertical screens
  238.  */
  239. #define VERTICAL_CHAR   0xba
  240.  
  241.  
  242. /*
  243.  * cursor size
  244.  */
  245. #define SMALL_INS       0
  246. #define BIG_INS         1
  247.  
  248.  
  249. /*
  250.  * possible answers to various questions - see get_yn, get_ynaq and get_oa
  251.  */
  252. #define A_YES           1
  253. #define A_NO            2
  254. #define A_ALWAYS        3
  255. #define A_QUIT          4
  256. #define A_ABORT         5
  257. #define A_OVERWRITE     6
  258. #define A_APPEND        7
  259.  
  260. /*
  261.  * The following defines specify which video attributes give desired
  262.  *  effects on different display devices.
  263.  * REVERSE is supposed to be reverse video - a different background color,
  264.  *  so that even a blank space can be identified.
  265.  * HIGH is supposed to quickly draw the user's eye to the relevant part of
  266.  *  the screen, either for a message or for matched text in find/replace.
  267.  * NORMAL is supposed to be something pleasant to look at for the main
  268.  *  body of the text.
  269.  */
  270. #define VIDEO_INT       0x10
  271.  
  272. #define HERC_REVERSE    0x70
  273. #define HERC_UNDER      0x01
  274. #define HERC_NORMAL     0x07
  275. #define HERC_HIGH       0x0f
  276.  
  277. #define COLOR_HEAD      0x4b
  278. #define COLOR_TEXT      0x07
  279. #define COLOR_DIRTY     0x02
  280. #define COLOR_MODE      0x17
  281. #define COLOR_BLOCK     0x71
  282. #define COLOR_MESSAGE   0x0f
  283. #define COLOR_HELP      0x1a
  284. #define COLOR_DIAG      0x0e
  285. #define COLOR_EOF       0x09
  286. #define COLOR_CURL      0x0f
  287. #define COLOR_RULER     0x02
  288. #define COLOR_POINTER   0x0a
  289. #define COLOR_OVRS      0x00
  290.  
  291. #define COLOR_80        3
  292. #define MONO_80         7
  293.  
  294. #define VGA             3
  295. #define EGA             2
  296. #define CGA             1
  297. #define MDA             0
  298.  
  299.  
  300. #define SAS_DELIMITERS  " \n"
  301.  
  302. /*
  303.  * let's explicitly treat characters as unsigned.
  304.  */
  305. typedef unsigned char far * text_ptr;
  306.  
  307.  
  308. /*
  309.  * "s_line_list" contains contains struct defs for a node of text.
  310.  */
  311. typedef struct s_line_list {
  312.    text_ptr line;                       /* pointer to line */
  313.    int      len;                        /* length of line */
  314.    int      dirty;                      /* boolean - dirty line indicator */
  315.    struct s_line_list far *next;        /* next line in doubly linked list */
  316.    struct s_line_list far *prev;        /* prev line in doubly linked list */
  317. } line_list_struc;
  318.  
  319. typedef line_list_struc far *line_list_ptr;
  320.  
  321.  
  322. struct vcfg {
  323.    int color;
  324.    int rescan;
  325.    int mode;
  326.    int far *videomem;
  327. };
  328.  
  329.  
  330. typedef struct {
  331.    char sig[8];                 /* signature, so we can find struct in .exe */
  332.    int  clr[2][NUM_COLORS];     /* one array for mono and another for color */
  333. } COLORS;
  334.  
  335.  
  336. /*
  337.  * structure for two key combos
  338.  */
  339. typedef struct {
  340.    int parent_key;
  341.    int child_key;
  342.    int func;
  343. } TWO_KEY_TYPE;
  344.  
  345.  
  346. typedef struct {
  347.    char sig[8];
  348.    TWO_KEY_TYPE key[MAX_TWO_KEYS];
  349. } TWO_KEY;
  350.  
  351.  
  352. typedef struct {
  353.    char sig[8];
  354.    unsigned char key[MAX_KEYS];
  355. } KEY_FUNC;
  356.  
  357.  
  358. /*
  359.  * structure used in directory list.
  360.  */
  361. typedef struct {
  362.    char fname[14];              /* file name */
  363.    long fsize;                  /* file size in bytes */
  364. } FTYPE;
  365.  
  366.  
  367. /*
  368.  * stuff we need to know about how to display a directory listing.
  369.  */
  370. typedef struct {
  371.    int  row;                    /* absolute row to display dir box */
  372.    int  col;                    /* absolute column to display dir box */
  373.    int  wid;                    /* absolute number of columns in dir box */
  374.    int  hgt;                    /* absolute number of rows in dir box */
  375.    int  max_cols;               /* number of columns of files in box */
  376.    int  max_lines;              /* number of lines of files in box */
  377.    int  cnt;                    /* file count */
  378.    int  cols;                   /* logical number of columns in list */
  379.    int  lines;                  /* logical number of rows in list */
  380.    int  prow;                   /* logical number of rows in partial row */
  381.    int  vcols;                  /* number of virtual columns, if any */
  382.    int  nfiles;                 /* number of files on screen */
  383.    int  avail;                  /* number of available slots for files */
  384.    int  select;                 /* current file under cursor */
  385.    int  flist_col[5];           /* offset from col to display each column */
  386. } DIRECTORY;
  387.  
  388.  
  389. typedef struct {
  390.    int  pattern_length;                 /* number of chars in pattern */
  391.    int  search_defined;                 /* search pattern defined? */
  392.    unsigned char pattern[MAX_COLS];     /* search pattern */
  393.    int  forward_md2;                    /* forward mini-delta2 */
  394.    int  backward_md2;                   /* backward mini-delta2 */
  395.    char skip_forward[256];              /* boyer array for forward searches */
  396.    char skip_backward[256];             /* boyer array for back searches */
  397. } boyer_moore_type;
  398.  
  399.  
  400. /*
  401.  * "mode_infos" contain the editor mode variables.  The configuration
  402.  *  utility modifies this structure to custimize the start-up tde
  403.  *  configuration
  404.  */
  405. typedef struct {
  406.    char sig[8];                 /* signature, so we can find struct in .exe */
  407.    int  color_scheme;           /* color to start out with */
  408.    int  sync;                   /* sync the cursor movement command? */
  409.    int  sync_sem;               /* sync the cursor movement command? */
  410.    int  record;                 /* are we recording keystrokes? */
  411.    int  insert;                 /* in insert mode? */
  412.    int  indent;                 /* in auto-indent mode? */
  413.    int  ptab_size;              /* physical tab stops */
  414.    int  ltab_size;              /* logical tab stops */
  415.    int  smart_tab;              /* smart tab mode on or off? */
  416.    int  inflate_tabs;           /* inflate tabs?  T or F */
  417.    int  search_case;            /* consider case? IGNORE or MATCH */
  418.    int  enh_kbd;                /* type of keyboard */
  419.    int  cursor_size;            /* insert cursor big or small? */
  420.    char *eof;                   /* message to display at end of file */
  421.    int  control_z;              /* write ^Z - t or f */
  422.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  423.    int  trailing;               /* remove trailing space? T or F */
  424.    int  show_eol;               /* show lf at eol? T or F */
  425.    int  word_wrap;              /* in word wrap mode? */
  426.    int  left_margin;            /* left margin */
  427.    int  parg_margin;            /* column for 1st word in paragraph */
  428.    int  right_margin;           /* right margin */
  429.    int  right_justify;          /* boolean, justify right margin?  T or F */
  430.    int  format_sem;             /* format semaphore */
  431.    int  undo_max;               /* max number of lines in undo stack */
  432.    int  do_backups;             /* create backup or ".bak" files? T or F */
  433.    int  ruler;                  /* show ruler at top of window? T or F */
  434.    int  date_style;             /* date style for date and time stamp */
  435.    int  time_style;             /* time style for date and time stamp */
  436. } mode_infos;
  437.  
  438.  
  439. /*
  440.  * "displays" contain all the status information about what attributes are
  441.  *  used for what purposes, which attribute is currently set, and so on.
  442.  * The editor only knows about one physical screen.
  443.  */
  444. typedef struct {
  445.    int nlines;                  /* lines on display device */
  446.    int ncols;                   /* columns on display device */
  447.    int line_length;             /* length of longest line */
  448.    int mode_line;               /* line to display editor modes - fmd */
  449.    int head_color;              /* file header color */
  450.    int text_color;              /* text area color */
  451.    int dirty_color;             /* text area color */
  452.    int mode_color;              /* mode line color - footer */
  453.    int block_color;             /* hilited area of blocked region */
  454.    int message_color;           /* color of editor messages */
  455.    int help_color;              /* color of help screen */
  456.    int diag_color;              /* color for diagnostics in mode line */
  457.    int eof_color;               /* color for end of file line */
  458.    int curl_color;              /* color of cursor line */
  459.    int ruler_color;             /* color of ruler line */
  460.    int ruler_pointer;           /* color of ruler pointer */
  461.    int hilited_file;            /* color of current file in dir list */
  462.    int overscan;                /* color of overscan color */
  463.    int old_overscan;            /* color of old overscan   */
  464.    int adapter;                 /* VGA, EGA, CGA, or MDA? */
  465.    unsigned int overw_cursor;   /* hi part = top scan line, lo part = bottom */
  466.    unsigned int insert_cursor;  /* hi part = top scan line, lo part = bottom */
  467.    char far *display_address;   /* address of display memory */
  468. } displays;
  469.  
  470.  
  471. /*
  472.  * "WINDOW" contains all the information that is unique to a given
  473.  *  window.
  474.  */
  475. typedef struct s_window {
  476.    struct s_file_infos *file_info;       /* file in window */
  477.    line_list_ptr ll;            /* pointer to current node in linked list */
  478.    int  ccol;                   /* column cursor logically in */
  479.    int  rcol;                   /* column cursor actually in */
  480.    int  bcol;                   /* base column to start display */
  481.    int  cline;                  /* line cursor logically in */
  482.    long rline;                  /* real line cursor in */
  483.    long bin_offset;             /* offset, in bytes from beg of bin file */
  484.    int  top_line;               /* top line in window */
  485.    int  bottom_line;            /* bottom line in window */
  486.    int  vertical;               /* boolean. is window split vertically? */
  487.    int  start_col;              /* starting column on physical screen */
  488.    int  end_col;                /* ending column on physical screen */
  489.    int  page;                   /* no. of lines to scroll for one page */
  490.    int  visible;                /* window hidden or visible */
  491.    int  letter;                 /* window letter */
  492.    int  ruler;                  /* show ruler in this window? */
  493.    char ruler_line[MAX_COLS+2]; /* ruler for this window */
  494.    struct s_window *next;       /* next window in doubly linked list */
  495.    struct s_window *prev;       /* previous window in doubly linked list */
  496. } WINDOW;
  497.  
  498.  
  499. /*
  500.  * struct for find first and find next functions.  see DOS technical ref
  501.  * manuals for more info on DTA structures.
  502.  */
  503. typedef struct {
  504.    char          reserved[21];
  505.    unsigned char attrib;
  506.    unsigned      time;
  507.    unsigned      date;
  508.    long          size;
  509.    char          name[13];
  510. } DTA;
  511.  
  512.  
  513. /*
  514.  * "status_infos" contain all the editor status information that is
  515.  *  global to the entire editor (i.e. not dependent on the file or
  516.  *  window)
  517.  */
  518. typedef struct {
  519.    WINDOW *current_window;      /* current active window */
  520.    struct s_file_infos *current_file; /* current active file */
  521.    struct s_file_infos *file_list; /* all active files */
  522.    WINDOW *window_list;         /* all active windows */
  523.    int  window_count;           /* number of windows - displayed and hidden */
  524.    int  file_count;             /* number of files currently open */
  525.    int  arg;                    /* current argument pointer */
  526.    int  found_first;            /* have we found the first file? */
  527.    int  argc;                   /* argument count */
  528.    char **argv;                 /* argument variables - same as *argv[] */
  529.    char path[MAX_COLS];         /* path for files on command line */
  530.    DTA  dta;                    /* disk transfer address for find next */
  531.    int  file_mode;              /* mode to open sas files, TEXT or BINARY */
  532.    int  file_chunk;             /* if opened BINARY, bytes per line */
  533.    int  sas_defined;            /* has search and seize been defined */
  534.    int  sas_search_type;        /* if defined, Boyer-Moore or reg expression? */
  535.    int  sas_arg;                /* current argument pointer */
  536.    int  sas_argc;               /* argument count */
  537.    char **sas_argv;             /* argument variables - same as *argv[] */
  538.    char sas_tokens[MAX_COLS];   /* storage for file tokens */
  539.    char sas_path[MAX_COLS];     /* path for files on search list */
  540.    char *sas_arg_pointers[SAS_P]; /* array of pointers to tokens in sas_path */
  541.    int  sas_found_first;        /* have we found the first file? */
  542.    DTA  sas_dta;                /* disk transfer address for find next */
  543.    long sas_rline;              /* line number of sas find */
  544.    int  sas_rcol;               /* column number of sas find */
  545.    int  sas_mode;               /* mode to open sas files, TEXT or BINARY */
  546.    int  sas_chunk;              /* if opened BINARY, bytes per line */
  547.    line_list_ptr sas_ll;        /* linked list node pointing to line */
  548.    int  marked;                 /* has block been marked? */
  549.    int  prompt_line;            /* line to display cursor */
  550.    int  prompt_col;             /* column to display cursor */
  551.    struct s_file_infos *marked_file;  /* pointer to file w/ marked block */
  552.    char rw_name[MAX_COLS];      /* name of last file read or written */
  553.    char pattern[MAX_COLS];      /* last search pattern */
  554.    char subst[MAX_COLS];        /* last substitute text */
  555.    int  replace_flag;           /* prompt or noprompt b4 replacing */
  556.    int  replace_defined;        /* replace defined ? */
  557.    int  overlap;                /* overlap between pages for page up etc */
  558.    line_list_ptr buff_node;     /* address of node in line_buff */
  559.    int  copied;                 /* has line been copied to file? */
  560.    char line_buff[BUFF_SIZE*2+8]; /* for currently edited line */
  561.    char tabout_buff[BUFF_SIZE+8]; /* for exanding tabs */
  562.    int  line_buff_len;          /* length of line in the line_buff */
  563.    int  tabout_buff_len;        /* length of line in the tabout_buff */
  564.    int  command;                /* function of key just entered */
  565.    int  key_pressed;            /* key pressed by user */
  566.    int  key_pending;            /* is two-key command waiting for next key? */
  567.    int  first_key;              /* first key of the two-key sequence */
  568.    int  wrapped;                /* is the wrapped message on mode line? */
  569.    int  stop;                   /* stop indicator */
  570.    int  control_break;          /* control break pressed? */
  571.    int  recording_key;          /* key we are assigning keystrokes to */
  572.    int  stroke_count;           /* free keys in stroke buffer */
  573.    int  macro_next;             /* pointer to next key in macro */
  574.    int  macro_executing;        /* flag set if macro is executing */
  575.    int  mstack_pointer;         /* pointer to macro stack */
  576.    int  current_macro;          /* index of currently executing macro */
  577.    int  screen_display;         /* screen display off or on? */
  578. } status_infos;
  579.  
  580.  
  581. /*
  582.  * marker structure used to save file positions.
  583.  */
  584. typedef struct {
  585.    long rline;                  /* real line of marker */
  586.    int  rcol;                   /* real column of marker */
  587.    int  ccol;                   /* logical column of marker */
  588.    int  bcol;                   /* base column of marker */
  589.    int  marked;                 /* boolean:  has this marker been set? */
  590. } MARKER;
  591.  
  592.  
  593. /*
  594.  * "file_infos" contain all the information unique to a given file
  595.  */
  596. typedef struct s_file_infos {
  597.    line_list_ptr line_list;    /* pointer to first node in linked list */
  598.    line_list_ptr line_list_end; /* pointer to last node in linked list */
  599.    line_list_ptr undo_top;     /* pointer to top node in undo stack */
  600.    line_list_ptr undo_bot;     /* pointer to last node in undo stack */
  601.    int  undo_count;            /* number of lines in undo stack */
  602.    MARKER marker[NO_MARKERS];  /* number of file markers */
  603.    long length;                /* number of lines in file */
  604.    int  modified;              /* file has been modified since save? */
  605.    int  dirty;                 /* file in window modified? */
  606.    int  new_file;              /* is current file new? */
  607.    int  backed_up;             /* has ".bak" file been created? */
  608.    int  crlf;                  /* when read, did lines end CRLF or LF? */
  609.    int  open_mode;             /* opened in BINARY or TEXT */
  610.    char file_name[MAX_COLS];   /* name of current file being edited */
  611.    char backup_fname[MAX_COLS];/* name of backup of current file */
  612.    int  block_type;            /* block type - line or box */
  613.    line_list_ptr block_start;  /* beginning block position */
  614.    line_list_ptr block_end;    /* ending block position */
  615.    int  block_bc;              /* beginning column */
  616.    long block_br;              /* beginning row */
  617.    int  block_ec;              /* ending column */
  618.    long block_er;              /* ending row */
  619.    int  file_no;               /* file number */
  620.    int  ref_count;             /* no. of windows referring to file */
  621.    int  next_letter;           /* next window letter */
  622.    unsigned int  file_attrib;  /* file attributes (rwx etc) */
  623.    struct s_file_infos *next;  /* next file in doubly linked list */
  624.    struct s_file_infos *prev;  /* previous file in doubly linked list */
  625. } file_infos;
  626.  
  627.  
  628. /*
  629.  * structure for recording and playing back one keystroke.
  630.  */
  631. typedef struct {
  632.   int key;      /* key assinged to this node, which may be text or function */
  633.   int next;     /* pointer to next node in macro def */
  634. } STROKES;
  635.  
  636.  
  637. /*
  638.  * structure for the macro buffer.
  639.  */
  640. typedef struct {
  641.    char sig[8];                         /* signature, easy to find in .exe */
  642.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  643.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  644. } MACRO;
  645.  
  646.  
  647. /*
  648.  * structure for the local macro stack in macro processor.
  649.  */
  650. typedef struct {
  651.    int key;                             /* key to begin execution in macro */
  652.    int macro;                           /* macro we were executing */
  653. } MACRO_STACK;
  654.  
  655.  
  656. /*
  657.  * structure for critical error handler.  check the flag for errors on
  658.  * each I/O call.
  659.  */
  660. typedef struct {
  661.    int  flag;                   /* 0 = no error, -1 = error */
  662.    int  code;                   /* error code from di */
  663.    int  rw;                     /* read or write operation? */
  664.    int  drive;                  /* drive number of error */
  665.    int  extended;               /* extended error code, func 0x59 */
  666.    int  class;                  /* error class */
  667.    int  action;                 /* suggested action from DOS */
  668.    int  locus;                  /* locus of error: drive, network, etc... */
  669.    int  dattr;                  /* device attribute, 0 = drive, 1 = serial */
  670.    char dname[10];              /* device name */
  671. } CEH;
  672.  
  673.  
  674. /*
  675.  * structure for sort strings
  676.  */
  677. typedef struct {
  678.    text_ptr pivot_ptr;
  679.    int  direction;
  680.    unsigned char *order_array;
  681.    int  block_len;
  682.    int  pivot_len;
  683.    int  bc;
  684.    int  ec;
  685. } SORT;
  686.  
  687.  
  688. typedef struct {
  689.    unsigned char ignore[256];
  690.    unsigned char match[256];
  691. } SORT_ORDER;
  692.  
  693.  
  694. /*
  695.  * structure for diff.  let's only diff two windows at a time.
  696.  */
  697. typedef struct {
  698.    int       defined;           /* initially FALSE */
  699.    int       leading;           /* skip leading spaces t/f */
  700.    int       all_space;         /* skip all space t/f */
  701.    int       blank_lines;       /* skip blank lines t/f */
  702.    int       ignore_eol;        /* skip end of line t/f */
  703.    WINDOW    *w1;               /* pointer to first diff window */
  704.    WINDOW    *w2;               /* pointer to second diff window */
  705.    line_list_ptr  d1;           /* pointer to text in window 1 */
  706.    line_list_ptr  d2;           /* pointer to text in window 2 */
  707.    long      rline1;            /* line number in window 1 */
  708.    long      rline2;            /* line number in window 2 */
  709.    long      bin_offset1;       /* binary offset in window 1 */
  710.    long      bin_offset2;       /* binary offset in window 2 */
  711. } DIFF;
  712.  
  713.  
  714. /*
  715.  * structures for regular expression searches.
  716.  */
  717. typedef struct {
  718.    int  pattern_length;                 /* number of chars in pattern */
  719.    int  search_defined;                 /* search pattern defined? */
  720.    int  node_count;                     /* number of nodes in the nfa */
  721.    unsigned char pattern[MAX_COLS];     /* search pattern */
  722. } REGX_INFO;
  723.  
  724.  
  725. typedef struct {
  726.    int  node_type[REGX_SIZE];
  727.    int  term_type[REGX_SIZE];
  728.    int  c[REGX_SIZE];
  729.    char *class[REGX_SIZE];
  730.    int  next1[REGX_SIZE];
  731.    int  next2[REGX_SIZE];
  732. } NFA_TYPE;
  733.  
  734.  
  735. typedef struct parse_tree {
  736.    int node_type;
  737.    int leaf_char;
  738.    char *leaf_string;
  739.    struct parse_tree *r_pt;
  740.    struct parse_tree *l_pt;
  741. } PARSE_TREE;
  742.